import request from "@/utils/request"

/**
 * 伪登录接口 - 只需要用户名，不需要密码
 */
export const pseudoLoginAPI = (username: string) => {
  return request.post("/web/auth/pseudo-login", { username })
}

/**
 * 获取用户信息
 */
export const getUserInfoByUsernameAPI = (username: string) => {
  return request.get(`/web/auth/user-info/${username}`)
}

/**
 * 获取所有用户列表
 */
export const getAllUsersAPI = () => {
  return request.get("/web/auth/users")
}

/**
 * 用户注册接口
 */
export interface RegisterData {
  username: string
  password: string
  nickname?: string
  gender?: number
  phone?: string
  email?: string
  introduction?: string
  github?: string
  gitee?: string
  csdn?: string
}

export const registerAPI = (data: RegisterData | FormData) => {
  return request.post("/web/auth/register", data, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

